%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The impact of divorce laws on the equilibrium in the marriage market.
% Ana Reynoso
% April 2024
%
% This file inputs the equilibrium impact of UD on the correlation in
% spousal education from data and model and produces Table A5.
%  
% Data: PSID 1968-1992
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%------------------------ Replication Path -------------------------------%

clc
clear all

%--- Indicate location of Replication folder:
%replication_location = 'C:\update_with_your_path';

%------------------------ Preliminaries ----------------------------------%

%--- Working directory
cd ([replication_location,'\Validation\Impact_PAM']);

%--- Path for functions
addpath(genpath([replication_location,'\Figures_and_Tables\matrix2latex']));

%--- Path for data
input_dir = [replication_location,'\Validation\Impact_PAM\Inputs'];
data_imp = importdata([input_dir,'/Table_A5_Data.csv']);

%--- Path for model
output_dir = [replication_location,'\Outputs'];
load([output_dir, '\UD\UD_effects_fullequilibrium']);

%------------------------ Table A5 ---------------------------------------%

Table_A5_Model = change_corr'*100;
Table_A5_Data = data_imp.data';

Table_A5 = [Table_A5_Model Table_A5_Data];
rowLabels = {'All markets', 'Northeast', 'Midwest and West', 'South Atlantic', 'South Central'};
columnLabels = {'Model', 'Data'};
%--- Store
matrix2latex(Table_A5, 'Output\Table_A5.tex',   'rowLabels', rowLabels, 'columnLabels', columnLabels, 'alignment', 'c', 'format', '%-6.2f', 'size', 'tiny');

